#!/user/bin/env node

const Koa = require('koa');
const app = new Koa();
const log = console.log;

app.use((ctx,next)=>{  
  console.log('logger');
  console.log(`${ctx.method}${ctx.path}`);
  next();
});

app.use((ctx,next)=>{
  const start = Date.now();//统计M-hello执行时间
  next();
  const end = Date.now();
  log(`M-hello-time:${end-start}`);
});

app.use((ctx,next)=>{
  ctx.body = 'hello world';
});

app.listen(8080);
